// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Transforms;

namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms;

[Trait("Category", "Processors")]
public class ResamplerTests
{
    [Theory]
    [InlineData(-2, 0)]
    [InlineData(-1, 0)]
    [InlineData(0, 1)]
    [InlineData(1, 0)]
    [InlineData(2, 0)]
    public static void BicubicWindowOscillatesCorrectly(float x, float expected)
    {
        IResampler sampler = KnownResamplers.Bicubic;
        float result = sampler.GetValue(x);

        Assert.Equal(result, expected);
    }

    [Theory]
    [InlineData(-2, 0)]
    [InlineData(-1, 0)]
    [InlineData(0, 1)]
    [InlineData(1, 0)]
    [InlineData(2, 0)]
    public static void Lanczos3WindowOscillatesCorrectly(float x, float expected)
    {
        IResampler sampler = KnownResamplers.Lanczos3;
        float result = sampler.GetValue(x);

        Assert.Equal(result, expected);
    }

    [Theory]
    [InlineData(-4, 0)]
    [InlineData(-2, 0)]
    [InlineData(0, 1)]
    [InlineData(2, 0)]
    [InlineData(4, 0)]
    public static void Lanczos5WindowOscillatesCorrectly(float x, float expected)
    {
        IResampler sampler = KnownResamplers.Lanczos5;
        float result = sampler.GetValue(x);

        Assert.Equal(result, expected);
    }

    [Theory]
    [InlineData(-2, 0)]
    [InlineData(-1, 0)]
    [InlineData(0, 1)]
    [InlineData(1, 0)]
    [InlineData(2, 0)]
    public static void TriangleWindowOscillatesCorrectly(float x, float expected)
    {
        IResampler sampler = KnownResamplers.Triangle;
        float result = sampler.GetValue(x);

        Assert.Equal(result, expected);
    }
}
